have array of objects stored in useState. doesn't update when using the updater function